﻿using OAuthResourceServerWebApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;

namespace OAuthResourceServerWebApi.Controllers
{
    [Authorize]
    public class UserInfoController : ApiController
    {
        public UserData Get()
        {
            return _getUserData();
        }

        public UserData Post()
        {
            return _getUserData();
        }

        private UserData _getUserData()
        {
            return new UserData()
            {
                UserName = HttpContext.Current.User.Identity.Name,
                Age = 29,
                FavoriteSites = new string[] { "http://www.cnblogs.com", "http://www.baidu.com" }
            };
        }
    }
}
